using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop.Member;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class Shop_Manage_shop_leave_message : Member, IRequiresSessionState
{
	protected LinkButton LinkAddMessage;
	protected GridView GridView3;
	protected PlaceHolder PlaceHolder2;
	protected TextBox TxtMessage;
	protected Button ButAdd;
	protected Button ButCancel;
	protected PlaceHolder PlaceHolder1;
	protected ObjectDataSource MessageDataSource;
	private int M_Type = 0;
	private int M_ProductID = -1;
	private int M_ShopID = -1;
	private int M_UserID = -1;
	private bool M_Status = false;
	private string M_Countent;
	public int ShopID = 0;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		this.ShopID = base.user.ShopID;
		if (this.ShopID <= 0)
		{
			this.WriteErrMsg("友情提示", Language.GetMemberMsg("Common/NoShop", new string[0]), "../Member/Shop_OpenShop.aspx");
		}
		this.MessageDataSource.SelectParameters["ShopID"].DefaultValue = this.ShopID.ToString();
	}
	protected void LinkAddMessage_Click1(object sender, EventArgs e)
	{
		this.PlaceHolder2.Visible = false;
		this.PlaceHolder1.Visible = true;
	}
	protected void ButCancel_Click(object sender, EventArgs e)
	{
		this.TxtMessage.Text = "";
	}
	protected void ButAdd_Click(object sender, EventArgs e)
	{
		this.M_Countent = this.TxtMessage.Text;
		this.M_Type = 1;
		this.M_ShopID = this.ShopID;
		this.M_UserID = base.user.UserID;
		this.M_Status = true;
		Shop_Message shop_Message = new Shop_Message();
		shop_Message.InsertMessage(this.M_Type, this.M_ProductID, this.M_ShopID, this.M_UserID, this.M_Status, this.M_Countent, base.user.UserName, this.M_UserID, "所有买家", "saler", 0);
		this.GridView3.DataBind();
		this.PlaceHolder2.Visible = true;
		this.PlaceHolder1.Visible = false;
	}
	protected void GridView3_DataBound(object sender, EventArgs e)
	{
		foreach (GridViewRow gridViewRow in this.GridView3.Rows)
		{
			if (gridViewRow.RowType == DataControlRowType.DataRow)
			{
				Literal literal = (Literal)gridViewRow.FindControl("ReplayContent");
				HyperLink hyperLink = (HyperLink)gridViewRow.FindControl("Replay");
				HiddenField hiddenField = (HiddenField)gridViewRow.FindControl("R_ID");
				if (literal.Text != "" && literal.Text != null)
				{
					hyperLink.Text = "修改回复";
					hyperLink.NavigateUrl = "replay_shop_message.aspx?messageID=" + hiddenField.Value + "&action=update";
				}
			}
		}
	}
}
